<template>
  <el-table :data="users"
            border
            style="width: 100%">
    <el-table-column prop=""
                     label="选择"
                     width="50"
                     align="center">
      <input type="checkbox">
    </el-table-column>
    <el-table-column prop="username"
                     label="用户名"
                     width="100"
                     align="center">
    </el-table-column>
    <el-table-column prop="realname"
                     label="真实姓名"
                     width="100"
                     align="center">
    </el-table-column>
    <el-table-column prop="phone"
                     label="手机号"
                     width="160"
                     align="center">
    </el-table-column>
    <el-table-column prop="role"
                     label="角色"
                     width="100"
                     align="center">
    </el-table-column>
    <el-table-column prop=""
                     label="启用状态"
                     width="100"
                     align="center">
      <el-switch v-model="value"
                 active-color="#13ce66"
                 inactive-color="#ff4949">
      </el-switch>
    </el-table-column>
    <el-table-column prop="time"
                     label="添加时间"
                     width="250"
                     align="center">
    </el-table-column>
    <el-table-column prop=""
                     label="操作"
                     width="200"
                     align="center">
      <template slot-scope="scope">
        <!-- scope里面记录了当前行的下标，数据 -->
        <el-button type="warning"
                   @click="update(scope)"
                   size="mini">编辑</el-button>
        <el-button type="danger"
                   @click="del(scope)"
                   size="mini">删除</el-button>
      </template>
    </el-table-column>
  </el-table>
</template>

<script>
export default {
  name: "MembersData",
  //接收父组件传递的数据
  props: {
    users: Array
  },
  data () {
    return {
      value: true
    }
  },
  methods: {
    info: function (scope) {
      this.$router.push({ name: 'PrescriptionDetail', query: { num: scope.row.num } })
    },
    update: function (scope) {

    },
    del: function (scope) {
      alert("删除")
    }
  }
}
</script>

<style scoped>
</style>
